﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Serialization;

namespace DataReceiver.DataAPI
{
    [Serializable]
    public class Model_Tick
    {
        /// <summary>
        /// 合约代码
        /// </summary>
        public string InstrumentID;
        /// <summary>
        /// 最新价
        /// </summary>
        public double LastPrice;
        /// <summary>
        ///申买价一
        /// </summary>
        public double BidPrice;
        /// <summary>
        ///申买量一
        /// </summary>
        public int BidVolume;
        /// <summary>
        ///申卖价一
        /// </summary>
        public double AskPrice;
        /// <summary>
        ///申卖量一
        /// </summary>
        public int AskVolume;
        /// <summary>
        ///数量
        /// </summary>
        public int Volume;
        /// <summary>
        ///持仓量
        /// </summary>
        public double OpenInterest;
        /// <summary>
        ///时间
        /// </summary>
        public DateTime UpdateTime;
    }

    [Serializable]
    public class Model_Bar
    {
        /// <summary>
        /// 合约代码
        /// </summary>
        public string InstrumentID;
        /// <summary>
        /// 开盘价
        /// </summary>
        public double OpenPrice;
        /// <summary>
        /// 最高价
        /// </summary>
        public double HighPrice;
        /// <summary>
        /// 最低价
        /// </summary>
        public double LowPrice;
        /// <summary>
        /// 收盘价
        /// </summary>
        public double ClosePrice;
        /// <summary>
        ///成交量
        /// </summary>
        public int Volume;
        /// <summary>
        ///持仓量
        /// </summary>
        public double OpenInterest;
        /// <summary>
        ///时间
        /// </summary>
        public DateTime UpdateTime;
    }

    [Serializable]
    public class Model_Instrument
    {
        /// <summary>
        /// 合约类型
        /// </summary>
        public string InstrumentType;

        /// <summary>
        /// 合约代码
        /// </summary>
        public string InstrumentID;

        /// <summary>
        /// 交易所代码
        /// </summary>
        public string ExchangeID;

        /// <summary>
        /// 合约数量乘数
        /// </summary>
        public int VolumeMultiple;

        /// <summary>
        /// 最小变动价位
        /// </summary>
        [XmlElement]
        public double PriceTick;
    }

    [Serializable]
    [XmlType(TypeName = "TdAccount")]
    public class Model_TdAccount
    {
        /// <summary>
        /// 服务器地址
        /// </summary>
        public string Server = "服务器IP";

        /// <summary>
        /// 经纪公司代码
        /// </summary>
        public string BrokerID = "交易商ID";

        /// <summary>
        /// 投资者代码
        /// </summary>
        public string InverstorID = "交易账号";

        /// <summary>
        /// 密码
        /// </summary>
        public string Passwd = "交易密码";
    }

    [Serializable]
    [XmlType(TypeName = "MdAccount")]
    public class Model_MdAccount:IComparable<Model_MdAccount>
    {
        public  int CompareTo(Model_MdAccount obj)
        {
            return InverstorID.CompareTo(obj.InverstorID);
        }

        /// <summary>
        /// 服务器地址
        /// </summary>
        public string Server = "服务器IP";

        /// <summary>
        /// 经纪公司代码
        /// </summary>
        public string BrokerID = "交易商ID";

        /// <summary>
        /// 投资者代码
        /// </summary>
        public string InverstorID = "行情账号";

        /// <summary>
        /// 密码
        /// </summary>
        public string Passwd = "行情密码";
    }
}
